package cn.edu.scau.dropship.mapper;

import cn.edu.scau.dropship.entity.Save_goods;
import cn.edu.scau.dropship.entity.Save_goodsExample;
import cn.edu.scau.dropship.entity.Save_goodsKey;
import java.util.List;
import org.apache.ibatis.annotations.Arg;
import org.apache.ibatis.annotations.ConstructorArgs;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface Save_goodsMapper {
    @SelectProvider(type=Save_goodsSqlProvider.class, method="countByExample")
    long countByExample(Save_goodsExample example);

    @DeleteProvider(type=Save_goodsSqlProvider.class, method="deleteByExample")
    int deleteByExample(Save_goodsExample example);

    @Delete({
        "delete from save_goods",
        "where goods_id = #{goodsId,jdbcType=INTEGER}",
          "and storehouse_id = #{storehouseId,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Save_goodsKey key);

    @Insert({
        "insert into save_goods (goods_id, storehouse_id, ",
        "goods_num)",
        "values (#{goodsId,jdbcType=INTEGER}, #{storehouseId,jdbcType=INTEGER}, ",
        "#{goodsNum,jdbcType=INTEGER})"
    })
    int insert(Save_goods record);

    @InsertProvider(type=Save_goodsSqlProvider.class, method="insertSelective")
    int insertSelective(Save_goods record);

    @SelectProvider(type=Save_goodsSqlProvider.class, method="selectByExample")
    @ConstructorArgs({
        @Arg(column="goods_id", javaType=Integer.class, jdbcType=JdbcType.INTEGER, id=true),
        @Arg(column="storehouse_id", javaType=Integer.class, jdbcType=JdbcType.INTEGER, id=true),
        @Arg(column="goods_num", javaType=Integer.class, jdbcType=JdbcType.INTEGER)
    })
    List<Save_goods> selectByExample(Save_goodsExample example);

    @Select({
        "select",
        "goods_id, storehouse_id, goods_num",
        "from save_goods",
        "where goods_id = #{goodsId,jdbcType=INTEGER}",
          "and storehouse_id = #{storehouseId,jdbcType=INTEGER}"
    })
    @ConstructorArgs({
        @Arg(column="goods_id", javaType=Integer.class, jdbcType=JdbcType.INTEGER, id=true),
        @Arg(column="storehouse_id", javaType=Integer.class, jdbcType=JdbcType.INTEGER, id=true),
        @Arg(column="goods_num", javaType=Integer.class, jdbcType=JdbcType.INTEGER)
    })
    Save_goods selectByPrimaryKey(Save_goodsKey key);

    @UpdateProvider(type=Save_goodsSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") Save_goods record, @Param("example") Save_goodsExample example);

    @UpdateProvider(type=Save_goodsSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") Save_goods record, @Param("example") Save_goodsExample example);

    @UpdateProvider(type=Save_goodsSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(Save_goods record);

    @Update({
        "update save_goods",
        "set goods_num = #{goodsNum,jdbcType=INTEGER}",
        "where goods_id = #{goodsId,jdbcType=INTEGER}",
          "and storehouse_id = #{storehouseId,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(Save_goods record);
}